package com.adee.nowcoder.huawei;

import java.util.Scanner;

public class T053_HJ053 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            // -1 -1 2 3 2 4 2 3 2 4 ... 2 3 2 4
            // 2 3 2 4 循环
            int[] arr = {2,3,2,4};
            if(n == 1 || n == 2) {
                System.out.println(-1);
            } else {
                System.out.println(arr[(n-3)%4]);
            }

        }
    }
}
